package com.edu.exam.enums.grading;

import com.edu.exam.enums.core.BaseEnum;

/**
 * UI主题枚举
 *
 * <p>定义批阅界面的主题选择，包括浅色、深色和自动主题。</p>
 *
 * @author System
 * @version 1.0.0
 * @since 2025-11-13
 */
public enum UiTheme implements BaseEnum {

    /** 浅色主题 */
    LIGHT("LIGHT", "浅色"),

    /** 深色主题 */
    DARK("DARK", "深色"),

    /** 自动主题（跟随系统） */
    AUTO("AUTO", "自动");

    private final String code;
    private final String description;

    UiTheme(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public static UiTheme fromCode(String code) {
        for (UiTheme theme : values()) {
            if (theme.getCode().equals(code)) {
                return theme;
            }
        }
        throw new IllegalArgumentException("Unknown UI theme code: " + code);
    }

    @Override
    public String toString() {
        return description;
    }
}